//文字滚动效果
$(function() {
	
	//标签云
	var data = [
		['歼20', 13, 100],
		['洞朗地区', 10, 123],
		['国足', 15, 222],
		['冯玉祥', 18, 111],
		['金砖国家', 17, 111],
		['产妇跳楼', 13, 111],
		['蜘蛛侠中国首映', 15, 111],
		['石墨烯', 10, 111],
		['ICO监管', 17, 111],
		['无现金社会', 15, 111],
		['互联网域名', 11, 111],
		['新能源车型', 14, 111],
		['无人驾驶', 8, 111],
		['默克尔', 9, 111],
		['厦门', 13, 111],
		['领克01', 17, 111],
        ['战狼2', 17, 111],
        ['超级高铁', 17, 111],
        ['木雕艺术', 8, 111],
        ['北海遇见北海', 9, 111]

	];

	var string_ = "";
	for(var i = 0; i < data.length; i++) {
		var string_f = data[i][0];
		var string_n = data[i][1];
		string_ += "{text: '" + string_f + "', weight: '" + string_n + "',html: {'class': 'span_list',onmouseover:'on_mouseover(this,event)',onmouseout:'on_mouseout()'}},";
	}

	function on_mouseover(e, ev) {
		var txt = $(e).html();
		ev = ev || event;
		$.each(data, function(i, item) {
			if(txt == item[0]) {
				var html = item[0] + "<br />曝光数" + item[1] + "<br />" + item[2];
				$("#my_favorite_latin_words").after("<div class='append_div' style='left:" + ev.clientX + "px; top:" + ev.clientY + "px; '>" + html + "</div>");
				return;
			}

		});
	}
	$(function() {
		$("#my_favorite_latin_words").jQCloud(word_list);
	});
	var string_list = string_;
	var word_list = eval("[" + string_list + "]");

	function on_mouseout() {
		$(".append_div").remove();
	}
	

	function addInterval(str) {
		var elem = str + " li"
		$(elem).first().css("background", "#348fe5")
		$(elem).first().css("font-weight", "bold")
		setInterval(function() {
			$(elem).each(function(i, n) {
				if(i == 1) {
					var height = $(n).css("height")
					$(n).animate({
						height: "0px"
					}, 1000, function() {
						this.remove()
						$(n).css("height", height)
						$(elem).last().after(this)
					})
				}
			})
		}, 3000);
	}
	
	function addIntervalNoTitle(str) {
		var elem = str + " li"
		setInterval(function() {
			$(elem).each(function(i, n) {
				if(i == 0) {
					var height = $(n).css("height")
					$(n).animate({
						height: "0px"
					}, 1000, function() {
						this.remove()
						$(n).css("height", height)
						$(elem).last().after(this)
					})
				}
			})
		}, 3000);
	}

	addInterval("#hot_user_table")
	addInterval("#hot_news_table")
	
	addIntervalNoTitle("#news_news_table1")
	addInterval("#news_news_table2")
	
	addIntervalNoTitle("#column_news_table1")
	addIntervalNoTitle("#column_news_table2")
	addIntervalNoTitle("#column_news_table3")
	addIntervalNoTitle("#column_news_table4")
	addIntervalNoTitle("#column_news_table5")
	addIntervalNoTitle("#column_news_table6")
});